package com.sunmouse.toolkit.fragment.menu;


import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.slidingmenu.SlidingMenu;
import com.sunmouse.toolkit.R;
import com.sunmouse.toolkit.fragment.BaseFragment;

/**
 * A simple {@link Fragment} subclass.
 */
public class SlidingFragment extends BaseFragment {
    private SlidingMenu mMenu;


    public SlidingFragment() {
        // Required empty public constructor
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        return inflater.inflate(R.layout.fragment_sliding, container, false);
    }

    @Override
    public void init() {
        //initMenu();
    }

    private void initMenu() {
        mMenu = new SlidingMenu(getActivity());
        mMenu.setMode(SlidingMenu.LEFT);
        mMenu.setBehindOffset(200);
        mMenu.setMenu(R.layout.menu_left);
        /**
         * SLIDING_WINDOW  full screen
         * SLIDING_CONTENT  below actionbar
         */
        mMenu.attachToActivity(getActivity(), SlidingMenu.SLIDING_WINDOW);
        mMenu.showMenu();
        mMenu.toggle();
    }

    @Override
    public void onPause() {
        super.onPause();
    }

    @Override
    public void onStop() {
        super.onStop();
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
//        if (mMenu != null) {
//            ((ViewGroup) getActivity().getWindow().getDecorView()).removeView(mMenu);
//            mMenu = null;
//        }
    }
}
